import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ApprovalFlowVO, ApprovalFlowForm, ApprovalFlowQuery } from '@/api/system/approvalFlow/types';

/**
 * 查询作业审批流转记录列表
 * @param query
 * @returns {*}
 */

export const listApprovalFlow = (query?: ApprovalFlowQuery): AxiosPromise<ApprovalFlowVO[]> => {
  return request({
    url: '/system/approvalFlow/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询作业审批流转记录详细
 * @param id
 */
export const getApprovalFlow = (id: string | number): AxiosPromise<ApprovalFlowVO> => {
  return request({
    url: '/system/approvalFlow/' + id,
    method: 'get'
  });
};

/**
 * 新增作业审批流转记录
 * @param data
 */
export const addApprovalFlow = (data: ApprovalFlowForm) => {
  return request({
    url: '/system/approvalFlow',
    method: 'post',
    data: data
  });
};

/**
 * 修改作业审批流转记录
 * @param data
 */
export const updateApprovalFlow = (data: ApprovalFlowForm) => {
  return request({
    url: '/system/approvalFlow',
    method: 'put',
    data: data
  });
};

/**
 * 删除作业审批流转记录
 * @param id
 */
export const delApprovalFlow = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/approvalFlow/' + id,
    method: 'delete'
  });
};
